 //
//  CourseTableViewCell.swift
//  约健
//
//  Created by tyh on 2017/9/15.
//  Copyright © 2017年 tyh. All rights reserved.
//

import UIKit

class CourseTableViewCell: UITableViewCell {
    var Name:UILabel!
    var Hot:UILabel!
    var TypeName:UILabel!
    var Pic:UIImageView! 
    var darksView:UIView!
    let width = UIScreen.main.bounds.width
    let radio:CGFloat = 0.2
    let widthboom = UIScreen.main.bounds.width/40
    let heightboom = (height*0.2)/20

    override func awakeFromNib() {
        super.awakeFromNib()
        
        Pic = UIImageView()
        Pic.image = UIImage(named: "1.jpg")
        self.contentView.addSubview(Pic)
        self.contentView.sendSubview(toBack: Pic)
        
        darksView = UIView()
        darksView.backgroundColor = UIColor(red: 0 / 255.0, green: 0 / 255.0, blue: 0 / 255.0, alpha: 0.4)
        self.contentView.addSubview(darksView)
        
        Name = UILabel()
        Name.text = "射箭菜鸟进阶"
        Name.font = UIFont.systemFont(ofSize: 18)
        Name.textColor = UIColor.white
        self.darksView.addSubview(Name)
        
        Hot = UILabel()
        Hot.text = "17878人参与"
        Hot.font = UIFont.systemFont(ofSize: 15)
        Hot.textColor = UIColor.white
        self.darksView.addSubview(Hot)
        
        TypeName = UILabel()
        TypeName.text = "菜鸟"
        TypeName.font = UIFont.systemFont(ofSize: 15)
        TypeName.textColor = UIColor.white
        self.darksView.addSubview(TypeName)
        

        
    }

    
    override func layoutSubviews() {
        super.layoutSubviews()
        
   

        
        Pic.frame = CGRect(x: 0, y: 0, width: width, height: height*radio-5)
        
        darksView.frame = CGRect(x: 0, y: 0, width: width, height: height*radio-5)
        
        Name.frame = CGRect(x: widthboom, y: heightboom, width: width - (2*widthboom), height: 5*heightboom)
        
        Hot.frame = CGRect(x: widthboom + (width - (2*widthboom))*3/4, y: height*radio - (6*heightboom), width: (width - (2*widthboom))/4, height: 5*heightboom)
        
        TypeName.frame = CGRect(x: widthboom, y: height*radio - (6*heightboom), width: (width - (2*widthboom))/4, height: 5*heightboom)
        
        
    }


    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
